*********************************************************
*********************************************************  
*** GBR 2024 --- JPE Revision Package *******************
*** Code for stats analyses, Studies 1,2,3 **************
*** Public (anonymized) *********************************
*********************************************************


**************************
**** Clean Data  *********
**************************

clear all
set more off

cd ".../JPEReplicationPackageDataverse/"
qui: do GBR24CleaningStudy1.do
qui: do GBR24CleaningStudy2.do
qui: do GBR24CleaningStudy3.do



**************************
**** Data Preparation ****
**************************

clear all
set more off

** Load datasets from Studies 1 to 3
append using ///
".../JPEReplicationPackageDataverse/GBR24DataCleanStudy3.dta" ///
".../JPEReplicationPackageDataverse/GBR24DataCleanStudy2.dta" ///
".../JPEReplicationPackageDataverse/GBR24DataCleanStudy1.dta", force

** Order observations by id (1 000 000 ids are from Study 1, 2 000 000 ids from Study2, 3 000 000 ids from Study 3)
order id

** Write zero for period indicators from other studies (they have missing data
* due to to the data construction)
quietly forvalues j=0(1)19 {
 replace period`j'=0 if period`j'==.
}



**************************
*** Tables and text ******
*** in main text *********
**************************



*** In text, sections I and VI.B: percentage of women who experienced discrimination at work (42%), and  percentage of women who experienced moderate to extensive discrimination at work (26%), see separate .do file "GBR24AdditionalInfoWomExperienceDiscrimination.do"



** Table 1: Piece-Rate Wages of the Two Workers in a Pair for the Four Payment Schemes
* Fourth column (N; each row is the number of workers per scheme)
* Create variable to identify the main four schemes
gen main_schemes=0
replace main_schemes=1  if low_equal==1 | high_equal==1 | low_unequal==1  /// 
| high_unequal==1 | low_disc==1 | high_disc==1
label variable main_schemes "Var indicating worker in one of main three treatments"
* first row:
count if low_equal==1
* second row:
count if high_equal==1
* third row:
count if low_unequal==1 | high_unequal==1
* fourth row:
count if low_disc==1 | high_disc==1



*** In text, section III.A
* Total number of workers in four main schemes
count if main_schemes==1
* Time duration of experiment in minutes (mean and sd)
sum Durationinminutes if main_schemes==1
* Monetary earnings in GBP (mean and sd)
gen pay_fixed_fee=0.70 if study==1
replace pay_fixed_fee=0.70 if study==2
replace pay_fixed_fee=0.90 if study==3
label variable pay_fixed_fee "Fixed payment (GBP) to worker"
gen pay_piecerate=0.03*l if lowwage_category!=. & study==1
replace pay_piecerate=0.03*l if lowwage_category!=. & study==2
replace pay_piecerate=0.04*l if lowwage_category!=. & study==3
replace pay_piecerate=0.06*l if highwage_category!=. & study==1
replace pay_piecerate=0.06*l if highwage_category!=. & study==2
replace pay_piecerate=0.07*l if highwage_category!=. & study==3
label variable pay_piecerate "Total piece-rate payment (GBP) to worker for lines completed"
gen earnings=pay_fixed_fee+pay_piecerate
label variable earnings "Total payment (GBP) to worker for study"
sum earnings



*** In text, section III.B
** Percentage of workers providing zero labor supply (3%)
count if l==0
count
di 152/4578
** Percentage of workers providing maixmum labor supply (17%)
count if l==85
count
di 785/4578

** Effect of high wage vs. low wage under equality (p>=.196)
* For Studies 1 and 3 with equality treatments, diffference in mean standardized labor supply between EqHigh (.1355491 sd) and EqLow (.0498489 sd) is .09 sd
sum sd_l if low_equal==1
sum sd_l if high_equal==1
di .1355491-.0498489
* Two-sided Mann-Whitney test (p=.196)
ranksum sd_l if low_equal==1 | high_equal==1, by(high_equal)
* Two-sided t test (p=.220)
ttest sd_l if low_equal==1 | high_equal==1, by(high_equal)

** Calculating labor supply elasticity under equality (e=0.06)
* Create elasticity by study and then weight overall
* elasticity by number of workers (N) in each study
* Study 1, mean labor supply is 43.19531 for low-wage workers and 44.03125 for high-wage workers, N is 256
sum l if low_equal==1 & study==1
sum l if high_equal==1 & study==1
count if low_equal==1 & study==1 | high_equal==1 & study==1
* Study 2 has no EqualLow and EqualHigh schemes
* Study 3, mean labor supply is 46.01 for low-wage workers and 48.62583 for high-wage workers, N is 602
sum l if low_equal==1 & study==3
sum l if high_equal==1 & study==3
count if low_equal==1 & study==3 | high_equal==1 & study==3
* Elasticity calculations ([[mean labor supply of high-wage workers under equality - mean labor supply of low-wage workers under equality]/[mean labor supply of low-wage workers under equality]]/[[high-wage - low-wages]/[low-wage]]):
* Elasticity for study 1 (using nominal wages of 3 and 6)
di ((44.03125-43.19531)/43.19531)/((6-3)/3)
* No elasticity for study 2
* Elasticity for study 3 (using nominal wages of 4 and 7)
di ((48.62583-46.01)/46.01)/((7-4)/4)
* Overall elasticity weighted by N of Study 1 and N of Study 3
di (256/(256+602))*((44.03125-43.19531)/43.19531)/((6-3)/3) ///
+ (602/(256+602))*((48.62583-46.01)/46.01)/((7-4)/4)

** Standardized effects
* Negative discrimination in Studies 1--3 (.0498489 sd, 0 sd, and -.1652645 sd)
sum sd_l if low_equal==1
sum sd_l if low_unequal==1
sum sd_l if low_disc==1
* UNEQDISC vs. UNEQ (.17 sd):
di 0+.1652645
* UNEQDISC vs. EQLOW (.22 sd):
di .0498489+.1652645
* UNEQ vs. EQLOW (.05 sd):
di .0498489-0

** Calculating percentage change in labor supply under negative discrimination vs. equal wages and vs. unequal wages
*Study1: 33.62238, 43.19531, and 38.32704, TotalN in study=589
sum l if low_disc==1 & study==1
sum l if low_equal==1 & study==1
sum l if low_unequal==1 & study==1
count if low_disc==1 & study==1 | low_equal==1 & study==1 | low_unequal==1 & study==1 
*Study2 43.28679, 47.69057, (no EqualLow scheme), TotalN in study=530
sum l if low_disc==1 & study==2
sum l if low_unequal==1 & study==2
count if low_disc==1 & study==2 | low_unequal==1 & study==2
*Study3: 41.91362, 46.01, and 46.06977, TotalN in study=902
sum l if low_disc==1 & study==3
sum l if low_equal==1 & study==3
sum l if low_unequal==1 & study==3
count if low_disc==1 & study==3 | low_equal==1 & study==3 | low_unequal==1 & study==3
* Calculations disc vs. equal by study:
scalar p_decrease_disc_equal_study1=(43.19531-33.62238)/43.19531
scalar p_decrease_disc_equal_study3=(46.01-41.91362)/46.01
* Calculations disc vs. equal overall, weighted by N of each study (14%):
scalar p_decrease_disc_equal_studies=((589)/(589+902))*p_decrease_disc_equal_study1 ///
+ ((902)/(589+902))*p_decrease_disc_equal_study3
di p_decrease_disc_equal_studies
* Calculations disc vs. unequal by study:
scalar p_decrease_disc_unequal_study1=(38.32704-33.62238)/38.32704
scalar p_decrease_disc_unequal_study2=(47.69057-43.28679)/47.69057
scalar p_decrease_disc_unequal_study3=(46.06977-41.91362)/46.06977
* Calculations disc vs. unequal overall, weighted by N of each study (10%):
scalar p_decrease_disc_unequal_studies=((589)/(589+530+902))*p_decrease_disc_unequal_study1 ///
+ ((530)/(589+530+902))*p_decrease_disc_unequal_study2 + ((902)/(589+530+902))*p_decrease_disc_unequal_study3
di p_decrease_disc_unequal_studies

* Footnote on tests of equality of three schemes
* Define controls
global controls age40 age50 age60 woman nat_uk ///
student unemployed parttime notInPaidJob ///
otheremployment num_approvals prolific_score ///
period1 period2 period3 period4 period6 period7 period8 ///
period9 period10 period11 period12 period14 period15 period16 ///
period17 period18 period19
* KW test
* low-wage workers (p<0.001)
dunntest sd_l if low_wage==1, by(anywage_category)
tobit l low_unequal low_disc i.study ///
$controls ///
if low_wage==1, ll(0) ul(85) vce(r)
test 0=low_disc=low_unequal
* high-wage workers (p>=0.4678)
dunntest sd_l if high_wage==1, by(anywage_category)
tobit l high_unequal high_disc i.study ///
$controls ///
if high_wage==1, ll(0) ul(85) vce(r)
test 0=high_unequal=high_disc



** Table 2: p-values of Differences in Labor Supply between Schemes in Studies 1 to 3 (three comparisons, Dunn`s tests)
* Erase graph export memory
est clear
* Rank test
* Low-wage workers, including BH correction
dunntest sd_l if low_wage==1, by(anywage_category)
matrix list r(P)
display .00051945*(3/2)
display .00022185*(3/1)
display .19950305*(3/3)
gen t2_r1_c1_p1=r(P)["r1", "c3"]
gen t2_r2_c1_p2=r(P)["r1", "c2"]
gen t2_r3_c1_p3=r(P)["r1", "c1"]
* Number of low-wage workers from Dunn's test output:
count if low_wage==1
gen t2_N_c1=2021
* High-wage workers, including BH correction
dunntest sd_l if high_wage==1, by(anywage_category)
matrix list r(P)
display .16721084*(3/1)
display .31521554*(3/2)
display .37178867*(3/3)
gen t2_r1_c2_p4=r(P)["r1", "c3"]
gen t2_r2_c2_p5=r(P)["r1", "c2"]
gen t2_r3_c2_p6=r(P)["r1", "c1"]
* Number of high-wage workers from Dunn's test output:
count if high_wage==1
gen t2_N_c2=2025
* Latex Table 2 core (0.001 are replaced by <0.001 manually when <0.001 hold)
gen t2_r1_p_bh=t2_r1_c1_p1*(3/2) if high_wage==0
gen t2_r2_p_bh=t2_r2_c1_p2*(3/1) if high_wage==0
gen t2_r3_p_bh=t2_r3_c1_p3*(3/3) if high_wage==0
replace t2_r1_p_bh=t2_r1_c2_p4*(3/1) if high_wage==1
replace t2_r2_p_bh=t2_r2_c2_p5*(3/2) if high_wage==1
replace t2_r3_p_bh=t2_r3_c2_p6*(3/3) if high_wage==1
gen t2_N=t2_N_c1 if high_wage==0 
replace t2_N=t2_N_c2 if high_wage==1 
estpost tabstat t2_r1_p_bh t2_r2_p_bh t2_r3_p_bh t2_N, by(high_wage) c(stat) stat(mean) nototal
esttab using ".../JPEReplicationPackageDataverse/Tables/table2_core.tex", replace ///
cells(mean(fmt(3 3 3 0))) nostar nonumber unstack ///
  nomtitle nonote noobs label  ///
   collabels(none) gap ///
   eqlabels("Low-Wage Workers" "High-Wage Workers") ///  
   nomtitles
* Note to Table 2 (six uncorrected p-values)
format t2_r1_c1_p1 t2_r2_c1_p2 t2_r3_c1_p3 t2_r1_c2_p4 t2_r2_c2_p5 t2_r3_c2_p6 %12.3f
sum t2_r1_c1_p1 t2_r2_c1_p2 t2_r3_c1_p3 t2_r1_c2_p4 t2_r2_c2_p5 t2_r3_c2_p6



** In text, section III.C: standardized effects
* Women (.0399842 sd, 0 sd, -.266996 sd)
sum sd_l_gender if low_equal==1 & woman==1
sum sd_l_gender if low_unequal==1 & woman==1
sum sd_l_gender if low_disc==1 & woman==1
* UNEQDISC vs. UNEQ (.27 sd):
di 0+.266996
* UNEQDISC vs. EQLOW (.31 sd):
di .0399842+.266996
* Men (.0656256 sd, 0 sd, -.068053 sd)
sum sd_l_gender if low_equal==1 & woman==0
sum sd_l_gender if low_unequal==1 & woman==0
sum sd_l_gender if low_disc==1 & woman==0
* UNEQDISC vs. UNEQ (.07 sd):
di 0+.068053
* UNEQDISC vs. EQLOW (.13 sd):
di .0656256+.068053
* Men (.1121516 sd, .2171026 sd, .0082233 sd)
sum sd_l_gender if high_equal==1 & woman==0
sum sd_l_gender if high_unequal==1 & woman==0
sum sd_l_gender if high_disc==1 & woman==0
* UNEQDISC vs. UNEQ (.21 sd):
di .2171026-.0082233



** Table 3: p-values of Differences in Labor Supply between Schemes in Studies 1 to 3, for Men and Women (three comparisons, Dunn`s tests)
* Erase graph export memory
est clear
** Negative discrimination rank test
* Men
dunntest sd_l_gender if low_wage==1  & woman==0, by(anywage_category)
matrix list r(P)
gen t3_r1_c1_p1=r(P)["r1", "c3"]
gen t3_r2_c1_p2=r(P)["r1", "c2"]
gen t3_r3_c1_p3=r(P)["r1", "c1"]
di 215 + 443 + 355
gen t3_N_r1_c1=1013
* BH correction
display 0.17321287*(6/4)
display 0.04965489*(6/3)
display 0.18227436*(6/5)
* Women
dunntest sd_l_gender if low_wage==1 & woman==1, by(anywage_category)
matrix list r(P)
gen t3_r4_c1_p4=r(P)["r1", "c3"]
gen t3_r5_c1_p5=r(P)["r1", "c2"]
gen t3_r6_c1_p6=r(P)["r1", "c1"]
di 213 + 441 + 354
gen t3_N_r2_c1=1008
* BH correction
display .00015016*(6/1)
display .00024582*(6/2)
display .29791938*(6/6)
** Positive discrimination rank test
* Men
dunntest sd_l_gender if high_wage==1  & woman==0, by(anywage_category)
matrix list r(P)
gen t3_r1_c2_p7=r(P)["r1", "c3"]
gen t3_r2_c2_p8=r(P)["r1", "c2"]
gen t3_r3_c2_p9=r(P)["r1", "c1"]
di 215+438+357
gen t3_N_r1_c2=1010
* BH correction
display .00207019*(6/1)
display .10422305*(6/3)
display .12483046*(6/4)
* Women
dunntest sd_l_gender if high_wage==1 & woman==1, by(anywage_category)
matrix list r(P)
gen t3_r4_c2_p10=r(P)["r1", "c3"]
gen t3_r5_c2_p11=r(P)["r1", "c2"]
gen t3_r6_c2_p12=r(P)["r1", "c1"]
di 215+446+354
gen t3_N_r2_c2=1015
* BH correction
display .03827544*(6/2)
display .31062602*(6/6)
display .15771467*(6/5)
* Latex Table 3 core (0.001 are replaced by <0.001 manually when <0.001 hold)
gen t3_r1_p_bh=t3_r1_c1_p1*(6/4) if high_wage==0
gen t3_r2_p_bh=t3_r2_c1_p2*(6/3) if high_wage==0
gen t3_r3_p_bh=t3_r3_c1_p3*(6/5) if high_wage==0
gen t3_r4_p_bh=t3_r4_c1_p4*(6/1) if high_wage==0
gen t3_r5_p_bh=t3_r5_c1_p5*(6/2) if high_wage==0
gen t3_r6_p_bh=t3_r6_c1_p6*(6/6) if high_wage==0
replace t3_r1_p_bh=t3_r1_c2_p7*(6/1) if high_wage==1
replace t3_r2_p_bh=t3_r2_c2_p8*(6/3) if high_wage==1
replace t3_r3_p_bh=t3_r3_c2_p9*(6/4) if high_wage==1
replace t3_r4_p_bh=t3_r4_c2_p10*(6/2) if high_wage==1
replace t3_r5_p_bh=t3_r5_c2_p11*(6/6) if high_wage==1
replace t3_r6_p_bh=t3_r6_c2_p12*(6/5) if high_wage==1
gen t3_N_r1=t3_N_r1_c1 if high_wage==0 
replace t3_N_r1=t3_N_r1_c2 if high_wage==1 
gen t3_N_r2=t3_N_r2_c1 if high_wage==0 
replace t3_N_r2=t3_N_r2_c2 if high_wage==1 
estpost tabstat t3_r1_p_bh t3_r2_p_bh t3_r3_p_bh t3_N_r1 t3_r4_p_bh t3_r5_p_bh t3_r6_p_bh t3_N_r2, by(high_wage) c(stat) stat(mean) nototal
esttab using ".../JPEReplicationPackageDataverse/Tables/table3_core.tex", replace ///
cells(mean(fmt(3 3 3 0 3 3 3 0))) nostar nonumber unstack ///
  nomtitle nonote noobs label  ///
   collabels(none) gap ///
   eqlabels("Low-Wage Workers" "High-Wage Workers") ///  
   nomtitles
* Note to Table 3 (12 uncorrected p-values)
format t3_r1_c1_p1 t3_r2_c1_p2 t3_r3_c1_p3 t3_r4_c1_p4 t3_r5_c1_p5 t3_r6_c1_p6 t3_r1_c2_p7 t3_r2_c2_p8 t3_r3_c2_p9 t3_r4_c2_p10 t3_r5_c2_p11 t3_r6_c2_p12 %12.3f
sum t3_r1_c1_p1 t3_r2_c1_p2 t3_r3_c1_p3 t3_r4_c1_p4 t3_r5_c1_p5 t3_r6_c1_p6 t3_r1_c2_p7 t3_r2_c2_p8 t3_r3_c2_p9 t3_r4_c2_p10 t3_r5_c2_p11 t3_r6_c2_p12, format



** In text, section III.D: see Appendix A Tables A11-A12 for more details
* Create indicator for providing positive labor supply vs. zero labor supply
gen participate=0 if l==0
replace participate=1 if l>0
label variable participate "Indicator for providing positive labor supply: 1Yes 0No"
* Negative discrimination (6% and 3%)
tab participate if low_unequal==1
tab participate if low_disc==1
* Positive discrimination (4% and 2%
tab participate if high_unequal==1
tab participate if high_disc==1



** Table 4: Implicit Discrimination, p-values of Differences in Labor Supply between Schemes in Study 2 (two comparisons, Dunn`s tests)
* Erase graph export memory
est clear
* Negative discrimination rank tests
dunntest l if low_wage_study2==1, by(lowwage_category_study2)
matrix list r(P)
gen t4_r1_c1_p1=r(P)["r1", "c1"]
gen t4_r2_c1_p2=r(P)["r1", "c3"]
di 265+266+265
gen t4_N_c1=796
* BH correction
display 0.3149*(2/2)
display 0.0078*(2/1)
* Positive discrimination rank tests
dunntest l if high_wage_study2==1, by(highwage_category_study2)
matrix list r(P)
gen t4_r1_c2_p3=r(P)["r1", "c1"]
gen t4_r2_c2_p4=r(P)["r1", "c3"]
di 266+266+265
gen t4_N_c2=797
* BH correction
display 0.4586*(2/2)
display 0.0797*(2/1)
* Latex Table 4 core
gen t4_r1_p_bh=t4_r1_c1_p1*(2/2) if high_wage==0
gen t4_r2_p_bh=t4_r2_c1_p2*(2/1) if high_wage==0
replace t4_r1_p_bh=t4_r1_c2_p3*(2/2) if high_wage==1
replace t4_r2_p_bh=t4_r2_c2_p4*(2/1) if high_wage==1
gen t4_N=t4_N_c1 if high_wage==0 
replace t4_N=t4_N_c2 if high_wage==1 
estpost tabstat t4_r1_p_bh t4_r2_p_bh t4_N, by(high_wage) c(stat) stat(mean) nototal
esttab using ".../JPEReplicationPackageDataverse/Tables/table4_core.tex", replace ///
cells(mean(fmt(3 3 0))) nostar nonumber unstack ///
  nomtitle nonote noobs label  ///
   collabels(none) gap ///
   eqlabels("Low-Wage Workers" "High-Wage Workers") ///  
   nomtitles
* Note to Table 4 (six uncorrected p-values)
format t4_r1_c1_p1 t4_r2_c1_p2 t4_r1_c2_p3 t4_r2_c2_p4 %12.3f
sum t4_r1_c1_p1 t4_r2_c1_p2 t4_r1_c2_p3 t4_r2_c2_p4, format



** In text, section IV.A:
* Total number of workers in Study 2
count if study==2
* For footnote: KW test equality of low-wage workers' beliefs across schemes
dunntest PE9, by(lowwage_category_study2)
* For footnote: MW test gender differences in low-wage workers' beliefs by scheme
ranksum PE9 if lowwage_U==1, by(woman)
ranksum PE9 if lowwage_UID==1, by(woman)
ranksum PE9 if lowwage_UED==1, by(woman)



** In text, section IV.B:
* See separate .do file for Study 4



** In text, section V:
** Dunn's test shows that negative discrimination decreases standardized labor supply relative to gender-neutral inequality significantly
dunntest l if low_wage==1 & study==3, by(anywage_category)
matrix list r(P)
* One-sided p
scalar mech_Dun_one_sided_p1=r(P)["r1", "c3"]/2
di mech_Dun_one_sided_p1
di .02392908/2
* N
di 300+301+301
** footnote addition of Dunn's test with smaller sample used in Table 5 (N=886)
dunntest l if low_wage==1 & study==3 & work_moral_motivation!=. & student!=. & unemployed!=., by(anywage_category)
matrix list r(P)
* One-sided p
scalar mech_Dun_one_sided_p2=r(P)["r1", "c3"]/2
di mech_Dun_one_sided_p2
di .01907952/2
* N
di 295+294+297
** footnote standardized effect (0.17 sd) of negative discrimination vs. gender-neutral inequality
sum sd_l if low_disc==1 & study==3
sum sd_l if low_unequal==1 & study==3
** Footnote on comprehension for reciprocity ""Is it true that nobody else than myself will derive any earnings from the lines of numbers and/or letters that I enter, including the researchers?" (C4, correct answer is 4)
tab C4
** Footnote on reciprocity beliefs
tab PE10_BeliefReward_withmorelines
di (2168)/3362
di (262+178)/3362
di (364)/3362
di (185+99)/3362
di (106)/3362
tab PE10_BeliefPunish_withmorelines
di (1385)/1782
di (144+77)/1782
di (112)/1782
di (42+9)/1782
di (13)/1782



** Table 5: Work Morale in Study 3
* Define controls
global controls age40 age50 age60 woman nat_uk ///
student unemployed parttime notInPaidJob ///
otheremployment num_approvals prolific_score ///
period1 period2 period3 period4 period6 period7 period8 ///
period9 period10 period11 period12 period14 period15 period16 ///
period17 period18 period19
* Erase graph export memory
est clear
* Column 1, effect of discr on labor supply
tab sd_l if study==3 
eststo model1: tobit sd_l low_equal low_disc ///
$controls ///
if low_wage==1 & study==3 & work_moral_motivation!=., ll(-1.933989) ul(1.634274) vce(r)
estadd local Controls "Yes": model1
estadd scalar R=e(r2_p): model1
* Divide two-sided p-values for coefficient of UNEQDISCR in table (indicated by a) and for the Wald test on EQLOW > UNEQDISC (one-sided p-value) shown in the bottom row of the table
test low_disc
di r(p)/2
scalar alpha=r(p)/2
test low_disc=low_equal
di r(p)/2
estadd scalar Waldp=r(p)/2: model1
** Additional info in the text and footnote: Rank tests
dunntest sd_l if low_wage==1 & study==3, by(anywage_category)
matrix list r(P)
di 300+301+301
di .02392908/2
dunntest sd_l if low_wage==1 & study==3 & work_moral_motivation!=., by(anywage_category)
matrix list r(P)
di 297+297+299
di .01907952/2
* Column 2, effect of discr on work morale
eststo model2: reg work_moral_motivation low_equal low_disc ///
$controls ///
if low_wage==1 & study==3, vce(r)
test low_disc
estadd local Controls "Yes": model2
estadd scalar R=e(r2): model2
* Column 3, corr between labor supply and work morale
eststo model3: tobit sd_l work_moral_motivation ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
test work_moral_motivation
estadd local Controls "Yes": model3
estadd scalar R=e(r2_p): model3
* Column 4, effect of discr on labor supply controlling for work morale
eststo model4: tobit sd_l low_equal low_disc work_moral_motivation ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
estadd local Controls "Yes": model4
estadd scalar R=e(r2_p): model4
* Divide two-sided p-values for coefficient of UNEQDISCR in table (indicated by a) and for the Wald test on EQLOW > UNEQDISC (one-sided p-value) shown in the bottom row of the table
test low_disc
di r(p)/2
test low_disc=low_equal
estadd scalar Waldp=r(p)/2: model4
di r(p)/2
test work_moral_motivation
* Column 5, effect of discr on labor supply controlling for work morale and
* interaction term between work morale and discr scheme
gen int_disc_work_moral_motivation=low_disc*work_moral_motivation
label variable int_disc_work_moral_motivation "interaction term work morale x EqLow"
eststo model5: tobit sd_l low_equal low_disc work_moral_motivation int_disc_work_moral_motivation ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
estadd local Controls "Yes": model5
estadd scalar R=e(r2_p): model5
* Divide two-sided p-values for coefficient of UNEQDISCR in table (indicated by a) and for the Wald test on EQLOW > UNEQDISC (one-sided p-value) shown in the bottom row of the table
test low_disc
di r(p)/2
test low_disc=low_equal
estadd scalar Waldp=r(p)/2: model5
di r(p)/2
test work_moral_motivation
test int_disc_work_moral_motivation
* Latex Table 5 core without title and notes (the alpha symbol for one-sided significance of UNEQDISCR in column 1 is added manually)
esttab, keep(low_equal low_disc work_moral_motivation int_disc_work_moral_motivation) b(3) se(3) noobs scalars("Controls Controls" "p Prob $>F$" "R $ R^{2}$ /Pseudo $ R^{2}$" "N N" "Waldp Wald one-sided p") sfmt(0 3 3 0 3) nomtitle label star($^{*}$ 0.10 $^{**}$ 0.05 $^{***}$ 0.01 $^{****}$ 0.001) nonotes
esttab using ".../JPEReplicationPackageDataverse/Tables/table5_core.tex", replace   ///
keep(low_equal low_disc work_moral_motivation int_disc_work_moral_motivation) b(3) se(3) noobs scalars("Controls Controls" "p Prob $>F$" "R $ R^{2}$ /Pseudo $ R^{2}$" "N N" "Waldp Wald one-sided p") sfmt(0 3 3 0 3) nomtitle label star($^{*}$ 0.10 $^{**}$ 0.05 $^{***}$ 0.01 $^{****}$ 0.001) nonotes
* Note to Table 5, one-sided alpha p-value
di alpha



** Table 6: Anger in Study 3
* Define controls
global controls age40 age50 age60 woman nat_uk ///
student unemployed parttime notInPaidJob ///
otheremployment num_approvals prolific_score ///
period1 period2 period3 period4 period6 period7 period8 ///
period9 period10 period11 period12 period14 period15 period16 ///
period17 period18 period19
* Erase graph export memory
est clear
* Column 1, effect of discr on anger
eststo model1: reg intensity_anger low_equal low_disc ///
$controls ///
if low_wage==1 & study==3, vce(r)
estadd local Controls "Yes": model1
estadd scalar R=e(r2): model1
test low_disc
* Column 2, corr between labor supply and anger
eststo model2: tobit sd_l intensity_anger ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
estadd local Controls "Yes": model2
estadd scalar R=e(r2_p): model2
test intensity_anger
* Column 3, effect of discr on labor supply controlling for anger
eststo model3: tobit sd_l low_equal low_disc intensity_anger ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
estadd local Controls "Yes": model3
estadd scalar R=e(r2_p): model3
test low_disc
* Divide two-sided p-value below by two for last row of table with one-sided p
test low_disc=low_equal
di r(p)/2
estadd scalar Waldp=r(p)/2: model3
test intensity_anger
* Column 4, effect of discr on labor supply controlling for anger and
* interaction term between work morale and discr scheme
gen int_disc_intensity_anger=intensity_anger*low_disc
label var int_disc_intensity_anger "interaction term anger x EqLow"
eststo model4: tobit sd_l low_equal low_disc intensity_anger int_disc_intensity_anger ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
test low_disc
estadd local Controls "Yes": model4
estadd scalar R=e(r2_p): model4
* Divide two-sided p-value below by two for last row of table with one-sided p
test low_disc=low_equal
di r(p)/2
estadd scalar Waldp=r(p)/2: model4
test intensity_anger
test int_disc_intensity_anger
* Column 5, effect of discr on labor supply controlling for anger and work morale
eststo model5: tobit sd_l low_equal low_disc intensity_anger work_moral_motivation ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
estadd local Controls "Yes": model5
estadd scalar R=e(r2_p): model5
test low_disc
* Divide two-sided p-value below by two for last row of table with one-sided p
test low_disc=low_equal
di r(p)/2
estadd scalar Waldp=r(p)/2: model5
test intensity_anger
test work_moral_motivation
* Column 6, effect of discr on labor supply controlling for anger and work morale with two interaction terms
eststo model6: tobit sd_l low_equal low_disc intensity_anger int_disc_intensity_anger ///
work_moral_motivation int_disc_work_moral_motivation ///
$controls ///
if low_wage==1 & study==3, ll(-1.933989) ul(1.634274) vce(r)
estadd local Controls "Yes": model6
estadd scalar R=e(r2_p): model6
test low_disc
* Divide two-sided p-value below by two for last row of table with one-sided p
test low_disc=low_equal
di r(p)/2
estadd scalar Waldp=r(p)/2: model6
test intensity_anger
test work_moral_motivation
test int_disc_intensity_anger
test int_disc_work_moral_motivation
* Latex Table 6 core without title and notes
esttab, keep(low_equal low_disc intensity_anger int_disc_intensity_anger work_moral_motivation int_disc_work_moral_motivation) b(3) se(3) noobs scalars("Controls Controls" "p Prob $>F$" "R $ R^{2}$ /Pseudo $ R^{2}$" "N N" "Waldp Wald one-sided p") sfmt(0 3 3 0 3) nomtitle label star($^{*}$ 0.10 $^{**}$ 0.05 $^{***}$ 0.01 $^{****}$ 0.001) nonotes
esttab using ".../JPEReplicationPackageDataverse/Tables/table6_core.tex", replace   ///
keep(low_equal low_disc intensity_anger int_disc_intensity_anger work_moral_motivation int_disc_work_moral_motivation) b(3) se(3) noobs scalars("Controls Controls" "p Prob $>F$" "R $ R^{2}$ /Pseudo $ R^{2}$" "N N" "Waldp Wald one-sided p") sfmt(0 3 3 0 3) nomtitle label star($^{*}$ 0.10 $^{**}$ 0.05 $^{***}$ 0.01 $^{****}$ 0.001) nonotes






**************************
** Figures in main text **
**************************

** 7 colors, from yellow to purple to blue
*rgb(255 215 0): yellow
*rgb(255 177 78): gold
*rgb(250 135 117): pink-beige
*rgb(234 95 148): pink
*rgb(205 52 181): pink-purple
*rgb(157 2 215): purple
*rgb(0 0 255): dark blue
* extra color bcolor(0 0 255%20


** Figure 1: Timeline of Studies 1 to 3
* Made in PowerPoint



** Figure 2: Mean Standardized Labor Supply per Scheme in Studies 1 to 3
graph bar (mean) sd_l, over(anywage_category, gap(*4) ///
relabel(1 "EqLow/EqHigh" 2 "Uneq" 3 "UneqDiscr")) ///
over(w, gap(*4) relabel(1 "Low-Wage Workers" 2 "High-Wage Workers")) ///
yscale(range(-0.25(0.05)0.25)) ylabel(-0.25(0.05)0.25, angle(0) glcolor(black*0.2)) exclude0 ytitle(Mean Standardized Labor Supply) /// 
asyvars legend(position(4) ring(0)) graphregion(color(white)) ///
 outergap(*3) bargap(5) ///
bar(1, bcolor(255 177 78) blcolor(gs4) blwidth(medium)) ///
bar(2, bcolor(205 52 181) blcolor(gs4) blwidth(medium)) ///
bar(3, bcolor(0 0 255) blcolor(gs4) blwidth(medium))
graph export ".../JPEReplicationPackageDataverse/Figures/GBR24_Figure2.eps", as(eps) replace
* Note to Figure 2 (Mean standardized labor supply and N per scheme)
sum sd_l if low_equal==1
sum sd_l if low_unequal==1 
sum sd_l if low_disc==1 
sum sd_l if high_equal==1
sum sd_l if high_unequal==1 
sum sd_l if high_disc==1 



** Figure 3: Mean Standardized Labor Supply per Gender and Payment Scheme in Studies 1 to 3
* Panel a --- men
graph bar (mean) sd_l_gender if woman==0, over(anywage_category, gap(*4) ///
relabel(1 "EqLow/EqHigh" 2 "Uneq" 3 "UneqDiscr")) ///
over(w, gap(*4) relabel(1 "Low-Wage Workers" 2 "High-Wage Workers")) ///
yscale(range(-0.30(0.05)0.30)) ylabel(-0.30(0.05)0.30, angle(0) glcolor(black*0.2)) exclude0 ytitle(Mean Standardized Labor Supply) /// 
asyvars legend(position(4) ring(0)) graphregion(color(white)) ///
 outergap(*3) bargap(5) ///
bar(1, bcolor(255 177 78) blcolor(gs4) blwidth(medium)) ///
bar(2, bcolor(205 52 181) blcolor(gs4) blwidth(medium)) ///
bar(3, bcolor(0 0 255) blcolor(gs4) blwidth(medium))
graph export ".../JPEReplicationPackageDataverse/Figures/GBR24_Figure3_a_men.eps", as(eps) replace
* Panel b --- women
graph bar (mean) sd_l_gender if woman==1, over(anywage_category, gap(*4) ///
relabel(1 "EqLow/EqHigh" 2 "Uneq" 3 "UneqDiscr")) ///
over(w, gap(*4) relabel(1 "Low-Wage Workers" 2 "High-Wage Workers")) ///
yscale(range(-0.30(0.05)0.30)) ylabel(-0.30(0.05)0.30, angle(0) glcolor(black*0.2)) exclude0 ytitle(Mean Standardized Labor Supply) /// 
asyvars legend(position(4) ring(0)) graphregion(color(white)) ///
 outergap(*3) bargap(5) ///
bar(1, bcolor(255 177 78) blcolor(gs4) blwidth(medium)) ///
bar(2, bcolor(205 52 181) blcolor(gs4) blwidth(medium)) ///
bar(3, bcolor(0 0 255) blcolor(gs4) blwidth(medium))
graph export ".../JPEReplicationPackageDataverse/Figures/GBR24_Figure3_b_women.eps", as(eps) replace
*Note to Figure 3 (N per scheme per gender)
* men
sum sd_l if low_equal==1 & woman==0
sum sd_l if low_unequal==1 & woman==0
sum sd_l if low_disc==1 & woman==0
sum sd_l if high_equal==1 & woman==0
sum sd_l if high_unequal==1 & woman==0
sum sd_l if high_disc==1 & woman==0
* women
sum sd_l if low_equal==1 & woman==1
sum sd_l if low_unequal==1 & woman==1
sum sd_l if low_disc==1 & woman==1
sum sd_l if high_equal==1 & woman==1
sum sd_l if high_unequal==1 & woman==1
sum sd_l if high_disc==1 & woman==1



**Figure 4: Mean Standardized Labor Supply per Scheme in Study 2
graph bar (mean) sd_l, over(anywage_category_study2, gap(*4) ///
relabel(1 "Uneq" 2 "UneqIm" 3 "UneqDiscr")) ///
over(high_wage_study2, gap(*4) relabel(1 "Low-Wage Workers" 2 "High-Wage Workers")) ///
yscale(range(-0.25(0.05)0.25)) ylabel(-0.25(0.05)0.25, angle(0) glcolor(black*0.2)) exclude0 ytitle(Mean Standardized Labor Supply) /// 
asyvars legend(position(4) ring(0)) graphregion(color(white)) ///
 outergap(*3) bargap(5) ///
bar(1, bcolor(205 52 181) blcolor(gs4) blwidth(medium)) ///
bar(2, bcolor(204 212 241) blcolor(gs4) blwidth(thin)) ///
bar(3, bcolor(0 0 255) blcolor(gs4) blwidth(medium))
graph export ".../JPEReplicationPackageDataverse/Figures/GBR24_Figure4.eps", as(eps) replace
* Note to Figure 4 (N per scheme)
sum sd_l if low_unequal==1 & study==2
sum sd_l if lowwage_UID==1 & study==2
sum sd_l if low_disc==1 & study==2
sum sd_l if high_unequal==1 & study==2
sum sd_l if highwage_UID==1 & study==2
sum sd_l if high_disc==1 & study==2



**Figure 5: see separate .do file for Study 4


